package com.rj.ability.leqi.adapter.handler;

import com.rj.ability.leqi.common.BaseLeqiInfoConfig;
import com.rj.ability.leqi.common.BaseUserInfo;
import com.rj.ability.leqi.common.BizSuccessCommonRes;
import com.rj.ability.leqi.common.JkbmEnum;

/**
 * 处理服务
 *
 * @author YFX_RANLUBO
 * @date 2024/08/07 16:53
 **/
public abstract class AbstractLeqiService<Req, LqReq, LqRes extends BizSuccessCommonRes, Res> {
    /**
     * 乐企配置信息
     */
    private BaseLeqiInfoConfig baseLeqiInfoConfig;
    /**
     * 乐企当前用户信息
     */
    private BaseUserInfo baseUserInfo;

    public BaseLeqiInfoConfig getBaseLeqiInfoConfig() {
        return baseLeqiInfoConfig;
    }

    public void setBaseLeqiInfoConfig(BaseLeqiInfoConfig baseLeqiInfoConfig) {
        this.baseLeqiInfoConfig = baseLeqiInfoConfig;
    }

    public BaseUserInfo getBaseUserInfo() {
        return baseUserInfo;
    }

    public void setBaseUserInfo(String taxId) {
        this.baseUserInfo = baseLeqiInfoConfig.queryBaseUserInfo(taxId);
    }

    /**
     * 本地请求对象转换为局端乐企请求对象
     *
     * @param req
     * @return
     */
    protected abstract LqReq convert(Req req);

    /**
     * 乐企请求结果转换为本地结果
     *
     * @param lqRes
     * @return
     */
    protected abstract Res convert(LqRes lqRes);

    /**
     * 接口编码
     *
     * @return
     */
    protected abstract JkbmEnum getJkbmEnum();


}
